package com.itheima.controller;


import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.itheima.common.R;
import com.itheima.dto.SaveDishDto;
import com.itheima.pojo.Dish;
import com.itheima.service.DishService;
import com.itheima.vo.DishDownVo;
import com.itheima.vo.DishListVo;
import com.itheima.vo.DishPageVo;
import com.itheima.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * @author Administrator
 */
@RestController
@RequestMapping("dish")
public class DishController {

    @Autowired
    private DishService dishService;


    @GetMapping("list")
    public R list(@RequestParam(value = "categoryId") String categoryId,
                  @RequestParam(value = "status") Integer status) {

        if (StrUtil.isNotEmpty(categoryId)) {
            List<Dish> list = dishService.getList(categoryId, status);
            return R.success(list);
        }

        return R.success(null);
    }


}
